/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/*
//ITERAR MAP
//http://stackoverflow.com/questions/46898/how-do-i-iterate-over-each-entry-in-a-map

for (Map.Entry<String, String> entry : map.entrySet())
{
    System.out.println(entry.getKey() + "/" + entry.getValue());
}
*/

/**
 *
 * @author Rdelacruz
 */
public class MapUtil {
    
    //metodos staticos genericos
    //http://stackoverflow.com/questions/4409100/how-to-make-a-java-generic-method-static
    
    //You can't use a class's generic type parameters in static methods or static fields. 
    //http://stackoverflow.com/questions/936377/static-method-in-a-generic-class
    
    
    //http://stackoverflow.com/questions/1026723/how-to-convert-a-map-to-list-in-java
    //OJO: Entrega los valores desordenados
    public static <K,V> List<V> mapToList(Map<K,V> map) {
        return new ArrayList<V>(map.values());
    }
    
    //http://stackoverflow.com/questions/7147107/converting-a-map-to-a-list
    //public static <K,V> List<Map.Entry<K,V>> mapToList(Map<K,V> map) {
    //    return new ArrayList<Map.Entry<K,V>>(map.keySet());
    //}
}
